const get = (key) => {
    try {
        const data = uni.getStorageSync(key);

        if (data) {
            if (data.expireTime > new Date().getTime()) {
                return data.data;
            } else {
                uni.removeStorageSync(key);
            }
        }
    } catch (e) {
        console.error(e);
    }
};

const set = (key, value, time) => {
    try {
        const data = {
            data: value,
            expireTime: time,
        }

        return uni.setStorageSync(key, data);
    } catch (e) {
        console.error(e);
    }
};

export default {
    get,
    set,
}
